import request from "@/utils/request";

// 学校端登录
export const login = (school) => request.post('/school/empLogin/login', school)

// 学校端一键更新活动状态
export const updateActivityStatus = () => request.post('/school/activity/updateStatus')

// 学校端活动管理
export const queryActivityList = (query) => request.post('/school/activity/list', query)
export const findActivity = (id) => request.get(`/school/activity/find?id=${id}`)
export const addActivity = (activity) => request.post('/school/activity/add', activity)
export const updateActivity = (activity) => request.post('/school/activity/update', activity)
export const deleteActivity = (id) => request.get(`/school/activity/delete?id=${id}`)

// 学校端学生管理
export const queryStudentList = (query) => request.post('/school/student/list', query)
export const findStudent = (id) => request.get(`/school/student/find?id=${id}`)
export const addStudent = (student) => request.post('/school/student/add', student)
export const updateStudent = (student) => request.post('/school/student/update', student)
export const deleteStudent = (id) => request.get(`/school/student/delete?id=${id}`)

// 获取当前登录学校信息
export const getSchoolInfo = () => request.get('/school/school/findInfo')

// 更新学校信息
export const updateSchoolInfo = (school) => request.post('/school/school/updateSchoolInfo', school)

// 图片上传
export const uploadImage = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return request.post('/upload/image', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 学校端员工管理
export const queryEmployeeList = (query) => request.post('/school/employee/list', query)
export const findEmployee = (id) => request.get(`/school/employee/find?id=${id}`)
export const addEmployee = (employee) => request.post('/school/employee/add', employee)
export const updateEmployee = (employee) => request.post('/school/employee/update', employee)
export const deleteEmployee = (id) => request.get(`/school/employee/delete?id=${id}`)

// 学校端反馈管理
export const queryFeedbackList = (query) => request.post('/school/feedback/list', query)
export const findFeedback = (id) => request.get(`/school/feedback/find?id=${id}`)
export const addFeedback = (feedback) => request.post('/school/feedback/add', feedback)
export const updateFeedback = (feedback) => request.post('/school/feedback/update', feedback)
export const deleteFeedback = (id) => request.get(`/school/feedback/delete?id=${id}`)

// 学校端活动审核管理
export const queryActivityCheckList = (query) => request.post('/school/check/list', query)
export const findActivityCheck = (id) => request.get(`/school/check/find?id=${id}`)
export const addActivityCheck = (activityCheck) => request.post('/school/check/add', activityCheck)
export const updateActivityCheck = (activityCheck) => request.post('/school/check/update', activityCheck)
export const deleteActivityCheck = (id) => request.get(`/school/check/delete?id=${id}`)

// Dashboard 统计数据API
export const getDashboardStats = () => request.get('/school/dashboard/stats')
export const getActivityStatusDistribution = () => request.get('/school/dashboard/activity-status')
export const getMonthlyTrends = () => request.get('/school/dashboard/monthly-trends')
export const getEnrollmentStats = () => request.get('/school/dashboard/enrollment-stats')
